// 全局类型定义

// 新增Usage相关类型
export interface UsageInfo {
  prompt_tokens: number;
  completion_tokens: number;
  total_tokens: number;
  cost?: number;
  reasoning_tokens?: number;
  cached_tokens?: number;
}

export interface Message {
  role: 'system' | 'user' | 'assistant' | 'tool';
  content: string;
  reasoning?: string;  // 新增reasoning字段
  tool_call_id?: string;
  tool_calls?: ToolCall[];
  usage?: UsageInfo;  // 新增usage字段
}

export interface ToolCall {
  id: string;
  type: 'function';
  function: {
    name: string;
    arguments: Record<string, any>;
  };
}

export interface ToolResult {
  tool_call_id: string;
  content: string;
}

export interface ModelConfig {
  name: string;
  apiKey: string;
}

export interface ChatCompletionRequest {
  model: string;
  messages: Message[];
  stream: boolean;
  max_tokens?: number;
  temperature?: number;
  provider?: {
    order:string[];
  };
  usage?: {
    include: boolean;
  };  // 新增usage参数
}

export interface StreamChunk {
  id?: string;
  choices?: Array<{
    delta?: {
      content?: string;
      reasoning?: string;
    };
    finish_reason?: string;
  }>;
  usage?: UsageInfo;  // 新增usage字段
}



// 对话分组类型
export interface ConversationGroup {
  userMessage: Message;
  assistantMessages: Message[];
  toolMessages: Message[];
  totalUsage: UsageInfo | null;
}

// 导出提示词相关类型
export * from './prompt';